﻿using Domain.Models;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;

namespace Infrastructure.Data.Config
{
    public class SyncLogConfiguration : IEntityTypeConfiguration<SyncLog>
    {
        public void Configure(EntityTypeBuilder<SyncLog> builder)
        {
            builder.HasKey(b => b.Id);

            builder.Property(b => b.Message)
                .IsRequired()
                .HasMaxLength(500);

            builder.Property("_createDateTime")
                .HasColumnName("CreateDateTime")
                .HasDefaultValueSql("strftime('%s','now')");

            builder.Ignore(b => b.CreateDateTime);
        }
    }
}
